package com.aabte.springcloudstudy.ribbonconsumer;

import com.aabte.springcloudstudy.computeservice.ComputeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Slf4j
@RequestMapping
@RestController
public class ConsumerFeignController {

    @Resource
    private ComputeService computeService;

    @RequestMapping(path = "/add-feign", method = RequestMethod.GET)
    public Integer addFeign(@RequestParam(name = "a") Integer a, @RequestParam(name = "b") Integer b) {
        log.info("start ConsumerController#addFeign.");
        Integer result = computeService.add(a, b);
        log.info("End ConsumerController#addFeign. result: {}", result);
        return result;
    }

}
